In Range operator

Basic and Crystal syntax.

Usage

x in y

Tests a range of value (y) to see if a value (x) falls within the range specified.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CurrentDate in CDate(1990, 09, 01) to CDate(1990, 09, 20)

Returns True, if today's date is September 15, 1990.

CurrentDate in CDate(1990, 09, 01) to CDate(1990, 09, 20)

Returns False, if today's date is September 21, 1990.

{file.QTY} in {file.ONHAND} to ({file.BACKORDER} + {file.ONORDER})

Returns True, where {file.QTY} = 20, {file.ONHAND} = 10, {file.BACKORDER} = 5, {file.ONORDER} = 25 (Is 20 in the range that begins with 10 and ends with the sum of 5 and 25?).

{file.QTY} in {file.ONHAND} to ({file.BACKORDER} + {file.ONORDER})

Returns False, where {file.QTY} = 31, {file.ONHAND} = 10, {file.BACKORDER} = 5, {file.ONORDER} = 25 (Is 31 in the range that begins with 10 and ends with the sum of 5 and 25?).

Comments

The combination of Make Range operator (x To y) and In Range operators is often used with the If-Then-Else operators operator. For example the Crystal syntax formula:

If ({file.AMOUNT} in (100.00 to 250.00)) Then

    (.10 * {file.AMOUNT})

Else

    0;

If the value of {file.AMOUNT} falls within the range 100.00 to 250.00, multiply .10 times {file.AMOUNT}. If it does not, it returns zero.

Related topics

Formula 9

Formula 10

DateTime function



Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com